
package proyectodatos1verano.modelo;

public class Palabra implements Comparable {
    private String palabra;
    private int x;
    private int y;
    public Palabra(){
        palabra="";
        x=0;
        y=0;
    }

    public Palabra(String palabra, int x, int y) {
        this.palabra = palabra;
        this.x = x;
        this.y = y;
    }

    public String getPalabra() {
        return palabra;
    }

    public void setPalabra(String palabra) {
        this.palabra = palabra;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public String toString() {
        return "Palabra{" + "palabra=" + palabra+", tam "+palabra.length() + ", x=" + x + ", y=" + y + '}';
    }

    @Override
    public int compareTo(Object t) {
        Palabra p= (Palabra) t;
        if(this.palabra.compareTo(p.getPalabra())==1)
            return 1;
        else if(this.palabra.compareTo(p.getPalabra())==-1)
            return -1;
        return 0;
    }
    
}
